﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public partial class TVAFBEZ : UIVAF
    {
        public TVAFBEZ()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VVAFARBEN();
            DataContext = MV;
            InitializeComponent();
        }
        public override void LOADBYAUF()
        {
            base.LOADBYAUF();
            if (ORDERNUM.Length < 39)
                return;
            if (!IsAutoVAF)
                return;
            if (TBMain.Rows.Count > 0)
                return;

            dwData = TBMain.NewRow();
            TMV.SetUpNewRow(ref dwData);
            dwData["VAFMANDANT"] = app.Mandant;
            dwData["VAFKOLL"] = ORDERNUM.Substring(0, 5);
            dwData["VAFART"] = ORDERNUM.Substring(5, 24);
            dwData["VAFFARBE"] = ORDERNUM.Substring(29, 10);

            dwData["VAFFFARBE"] = dwData["VAFFARBE"];
            dwData["VAFPART"] = ORDERNUM.Substring(5, 20); ;
            dwData["VAFPLART"] = ORDERNUM.Substring(5, 20); ;
            Insert(dwData);  
        } 
    }
}
